const baseUrl = 'https://api-hmugo-web.itheima.net/api/'
const request = (params) => {
return new Promise((resolve,reject)=>{
  wx.showLoading({
    title: '拼命加载中',
  })
  wx.request({
    url: baseUrl + params.url,
    method: params.method || 'GET',
    data: params.data||'',
    success: res=>{
      resolve(res.data.message)
      wx.hideLoading()
    },
    fail:err=>{
      wx.hideLoading()
    },
    complete:com=>{
      wx.hideLoading()
    }
  })
})
 
}

export default request